//***************************************************************
//* Name:      mObjects.h
//* Purpose:   draw images
//* Author:    Riku Maikola (rpm@ac-mapa.org)
//* Created:   2013-01-27
//* Copyright: Riku Maikola (rpm.ac-mapa.org)
//* License:
//**************************************************************/

#ifndef mObject_H
#define mObject_H

#include <wx/glcanvas.h>
#include "mPointArray.h"

struct vbo
{
public:
    unsigned char id[3];
    GLfloat r,g,b,a;
    GLfloat x,y,z;
    GLfloat nx,ny,nz;
};

class oColor
{
    public:
    GLfloat R,G,B,A;
};

oColor oC(double r,double g,double b,double a=1);

//********************************************//
//**                                        **//
//********************************************//
class mObject
{
private:
    std::vector<vbo> dta;                   //new way
public:
    bool show=true;
    double width;

    GLuint TYPE;

    mObject(){};

    //************************//
    void add(uint ID,mPoint p,oColor c=oC(0,0,0),mPoint n = mP(0,0,0));
    void add(mPoint,mPoint,mPoint,oColor);
    void add(mPointArray A, oColor , double W=1 , uint ID=10000000);

    void clear();

    //****************************************************************************//
    void Lathe(mPointArray*, oColor C,double accuracy=60);                        //DUMMY only use in meshlist
    void load(wxString,mPoint P=mP(0,0,0),double K=1000);

    //*****************************************//
    void render();
    void render(oColor,double);
    void renderID();
};

//*******************************//
//**                           **//
//*******************************//
class mObjectCTRL
{
private:

public:
    std::vector<mObject> O;
    uint addToList(GLuint);
    void render();
};

#endif
